public class Test6 {
    public static void main(String[] args) {
        int[] a = {-2,11,-4,13,-5,-2};
        //1.创建dp表
        int[] dp = new int[a.length];
        //2.初始化
        dp[0] = a[0];
        //3.填表
        for(int i = 1;i < a.length;i++){
            dp[i] = Math.max(a[i],dp[i - 1] + a[i]);
        }
        int max = Integer.MIN_VALUE;
        for(int i = 0;i < dp.length;i++){
            if(max < dp[i])
                max = dp[i];
        }
        System.out.println(max);
    }
}
